//package com.example.demo.config.datasource;
//
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.orm.jpa.JpaTransactionManager;
//import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
//import org.springframework.transaction.PlatformTransactionManager;
//
//
//import javax.persistence.EntityManagerFactory;
//import javax.sql.DataSource;
//import java.util.HashMap;
//
///**
// * 集群模式配置
// *
// * @author:Frankiegg
// * @date:2018/4/12
// * @project:springboot
// **/
//@Configuration
//@EnableJpaRepositories(entityManagerFactoryRef = "redisEntityManagerFactory",
//        basePackages = {"com.example.demo.DAO.JPADao"},
//        transactionManagerRef = "redisTransactionManager"
//        )
//public class JpaConfig {
//
//
//    @Bean(name = "redisEntityManagerFactory")
//    @Autowired
//    public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
//                                                                       @Qualifier("redisDB") DataSource dataSource){
//        HashMap<String,String> props=new HashMap<>();
//        props.put("hibernate.jdbc.batch_size","20");
//        return builder
//                .dataSource(dataSource)
//                .packages("com.example.demo.pojo.redisPojo")
//                .persistenceUnit("RedisPojo")
//                .properties(props).build();
//    }
//
//    /**
//     * 配置持久化层事务管理
//     *
//     * @param entityManagerFactory
//     * @return
//     */
//    @Bean(name = "redisTransactionManager")
////    public PlatformTransactionManager transactionManager(
////            @Qualifier("redisEntityManagerFactory")
////                    EntityManagerFactory entityManagerFactory){
////        return new JpaTransactionManager(entityManagerFactory);
////    }
////
////    @Bean("jdbcTemplate")
////    public JdbcTemplate jdbcTemplate(@Qualifier(value = "redisDB") DataSource dataSource){
////        return new JdbcTemplate(dataSource);
////    }
//}
